<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var num = Number(prompt('出生年份：'));
        var age = 2021 - num;
        alert('您的年龄是' + age + '岁了，还不加油？');
        console.log(age);
    </script>
</head>

<body>

</body>

</html>